package org.test.hadoop.mapreduce;

import java.io.IOException;
import java.util.Iterator;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

public class SplitWordCountReduce extends
		Reducer<Text, IntWritable, Text, IntWritable> {

	@Override
	protected void reduce(Text text, Iterable<IntWritable> value,
			Reducer<Text, IntWritable, Text, IntWritable>.Context context)
			throws IOException, InterruptedException {
		int i =0;
		Iterator<IntWritable> it = value.iterator();
		while(it.hasNext()){
			IntWritable v = it.next();
			i= i+v.get();
		
		}
		context.write(text, new IntWritable(i));
	}

}
